<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    966. Binary Subarrays With Sum
   </h1>
   <p>
    In an array
    <code>
     A
    </code>
    of
    <code>
     0
    </code>
    s and
    <code>
     1
    </code>
    s, how many
    <strong>
     non-empty
    </strong>
    subarrays have sum
    <code>
     S
    </code>
    ?
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input: </strong>A = <span id="example-input-1-1">[1,0,1,0,1]</span>, S = <span id="example-input-1-2">2</span>
<strong>Output: </strong><span id="example-output-1">4</span>
<strong>Explanation: </strong>
The 4 subarrays are bolded below:
[<strong>1,0,1</strong>,0,1]
[<strong>1,0,1,0</strong>,1]
[1,<strong>0,1,0,1</strong>]
[1,0,<strong>1,0,1</strong>]
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <ol>
    <li>
     <code>
      A.length &lt;= 30000
     </code>
    </li>
    <li>
     <code>
      0 &lt;= S &lt;= A.length
     </code>
    </li>
    <li>
     <code>
      A[i]
     </code>
     &nbsp;is either
     <code>
      0
     </code>
     &nbsp;or
     <code>
      1
     </code>
     .
    </li>
   </ol>
  </div>
  <div>
   <h1 class="question_title">
    966. 和相同的二元子数组
   </h1>
   <p>
    在由若干&nbsp;
    <code>
     0
    </code>
    &nbsp;和&nbsp;
    <code>
     1
    </code>
    &nbsp; 组成的数组&nbsp;
    <code>
     A
    </code>
    &nbsp;中，有多少个和为
    <code>
     S
    </code>
    &nbsp;的
    <strong>
     非空
    </strong>
    子数组。
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     示例：
    </strong>
   </p>
   <pre><strong>输入：</strong>A = [1,0,1,0,1], S = 2
<strong>输出：</strong>4
<strong>解释：</strong>
如下面黑体所示，有 4 个满足题目要求的子数组：
[<strong>1,0,1</strong>,0,1]
[<strong>1,0,1,0</strong>,1]
[1,<strong>0,1,0,1</strong>]
[1,0,<strong>1,0,1</strong>]
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     提示：
    </strong>
   </p>
   <ol>
    <li>
     <code>
      A.length &lt;= 30000
     </code>
    </li>
    <li>
     <code>
      0 &lt;= S &lt;= A.length
     </code>
    </li>
    <li>
     <code>
      A[i]
     </code>
     &nbsp;为&nbsp;
     <code>
      0
     </code>
     &nbsp;或&nbsp;
     <code>
      1
     </code>
    </li>
   </ol>
  </div>
 </body>
</html>